/**
 * 作者:李杰
 * email: maillijie@gmail.com
 */
package com.javainfo.entity;

import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.Type;

@Entity
public class SubArticle {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;

	/** 文章标题 */
	private String title;

	/** 文章内容 */
	@Type(type="text")
	private String content;
	
	/** 创建时间 */
	private Date createTime;
	
	/** 更新时间 */
	private Date updateTime;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "articleId")
	private Article article;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userId")
	private User user;

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinColumn(name = "subArticleId")
	private Set<Attachments> attachmentsSet;
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Article getArticle() {
		return article;
	}

	public void setArticle(Article article) {
		this.article = article;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public Set<Attachments> getAttachmentsSet() {
		return attachmentsSet;
	}

	public void setAttachmentsSet(Set<Attachments> attachmentsSet) {
		this.attachmentsSet = attachmentsSet;
	}
	
	////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////
	
}
